import axios from '@/api/request/request'

// 获取列表
const getRoles = (option?: any) => {
  return axios.post('/auth/role/pageRole', {
    ...option
  })
}

// 获取全部列表
const roleList = (option?: any) => {
  return axios.post('/auth/role/roleList', {
    ...option
  })
}

// 根据角色id获取pc菜单列表
const getRoleMenuList = (option: any) => {
  return axios.post('/auth/roleMenu/roleMenuList', {
    ...option
  })
}

// 根据角色id获取小程序菜单列表
const getRoleMiniMenuList = (option: any) => {
  return axios.post('/auth/sysMobileRoleMenu/roleMenuList', {
    ...option
  })
}

// 添加
const addRoles = (option: any) => {
  return axios.post('/auth/role/addRole', {
    ...option
  })
}

// 删除节点
const delRoles = (option: any) => {
  return axios.post('/auth/role/deleteRole', {
    ...option
  })
}

// 更新节点
const updateRole = (option: any) => {
  return axios.post('/auth/role/updateRole', {
    ...option
  })
}

// 更新节点选中
const saveOrUpdate = (option: any) => {
  return axios.post('/auth/roleMenu/saveOrUpdate', option)
}

// 更新小程序节点选中
const saveOrUpdateMini = (option: any) => {
  return axios.post('/auth/sysMobileRoleMenu/saveOrUpdate', option)
}

export { getRoles, roleList, getRoleMenuList, getRoleMiniMenuList, addRoles, delRoles, updateRole, saveOrUpdate, saveOrUpdateMini }
